﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace EasyTrader.Wave
{
    public class PriceWave
    {
        private int m_StartX = 0;
        public int StartX
        {
            get { return m_StartX; }
            set { m_StartX = value; }
        }
        private int m_EndX = 0;
        public int EndX
        {
            get { return m_EndX; }
            set { m_EndX = value; }
        }
        private int m_Slope = 0;
        public int Slope
        {
            get { return m_Slope; }
            set { m_Slope = value; }
        }
        private double m_StartY = 0;
        public double StartY
        {
            get { return m_StartY; }
            set { m_StartY = value; }
        }
        private double m_EndY = 0;
        public double EndY
        {
            get { return m_EndY; }
            set { m_EndY = value; }
        }

        public PriceWave Clone()
        {
            PriceWave newWave = new PriceWave();
            newWave.StartX = m_StartX;
            newWave.StartY = m_StartY;
            newWave.EndX = m_EndX;
            newWave.EndY = m_EndY;
            newWave.Slope = m_Slope;
            return newWave;
        }

        public int Length()
        {
            return Math.Abs(m_EndX - m_StartX);
        }

        public double Height()
        {
            return Math.Abs(m_EndY - m_StartY);
        }

        // 파동내 고가에서 최고값
        private double m_HighY = 0.0;
        public double HighY
        {
            get { return m_HighY; }
            set { m_HighY = value; }
        }
        // 파동내 저가에서 최저값
        private double m_LowY = 0.0;
        public double LowY
        {
            get { return m_LowY; }
            set { m_LowY = value; }
        }
        // 파동내 종가의 최고값
        private double m_CloseMax = 0.0;
        public double CloseMax
        {
            get { return m_CloseMax; }
            set { m_CloseMax = value; }
        }
        // 파동내 종가의 최저값
        private double m_CloseMin = 0.0;
        public double CloseMin
        {
            get { return m_CloseMin; }
            set { m_CloseMin = value; }
        }
        private int m_HighX = 0;
        public int HighX
        {
            get { return m_HighX; }
            set { m_HighX = value; }
        }
        private int m_LowX = 0;
        public int LowX
        {
            get { return m_LowX; }
            set { m_LowX = value; }
        }
        private int m_CloseMinX = 0;
        public int CloseMinX
        {
            get { return m_CloseMinX; }
            set { m_CloseMinX = value; }
        }
        private int m_CloseMaxX = 0;
        public int CloseMaxX
        {
            get { return m_CloseMaxX; }
            set { m_CloseMaxX = value; }
        }

        public int GetSlope()
        {
            double deltaY = m_EndY - m_StartY;
            if (deltaY > 0)
                return GlobalVar.PriceUp;
            else if (deltaY < 0)
                return GlobalVar.PriceDown;
            else
                return GlobalVar.PriceFlat;
        }
    }
}
